//
//  ChooseTypeTableViewController.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/7/5.
//  Copyright © 2016年 wl. All rights reserved.
//

import UIKit

class ChooseTypeTableViewController: UITableViewController {
    
    
    var modelList: [String] = ["厂商代理公司", "培训教育咨询机构", "美容院经营者", "美容院院长(职业经理人)", "美容师", "美容顾问（业务员）", "业务经理（职业经理人）"]
    
    override func viewDidLoad() {
        super.viewDidLoad()

       
        publicMethod.hiddleExtendCellForTableView(self.tableView)
        self.title = "选择会员类别"
    }
   
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.navigationBar.barTintColor = NAVIGATIONBAR_RED_COLOR
        self.tabBarController?.tabBar.hidden = true
    }    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
       
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return modelList.count
    }

    override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
        if(cell.respondsToSelector(Selector("setSeparatorInset:"))) {
            cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0)
        }
        if(cell.respondsToSelector(Selector("setLayoutMargins:"))) {
            cell.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0)
        }
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("ChooseTypeTableViewCell", forIndexPath: indexPath) as! ChooseTypeTableViewCell

        // Configure the cell...
        cell.TitleLable.text = modelList[indexPath.row]

        return cell
    }
    
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        if indexPath.row == 0 || indexPath.row == 1{
            let vc = self.storyboard?.instantiateViewControllerWithIdentifier("FactoryComplementedTableViewController") as! FactoryComplementedTableViewController
        
            vc.memberType = modelList[indexPath.row]
            self.navigationController?.pushViewController(vc, animated: true)
        }
        else if indexPath.row == 2 || indexPath.row == 3 {
            let  vc = self.storyboard?.instantiateViewControllerWithIdentifier("BeautySalonUserTC") as! BeautySalonUserTC
           
            vc.memberType = modelList[indexPath.row]
            self.navigationController?.pushViewController(vc, animated: true)

        }else{
            
            let vc = self.storyboard?.instantiateViewControllerWithIdentifier("OtherComplementedTableViewController") as! OtherComplementedTableViewController
            vc.memberType = modelList[indexPath.row]
            self.navigationController?.pushViewController(vc, animated: true)
        }
    }
    
}
